home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung 2 / Power-Programmierung CD 2 (Tewi)(1994).iso / c / library / dos / grafik / sega / pvquant / giflib / gif_hash.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-11-21  |  2.4 KB  |  42 lines

  1. /************************************************************************
  2.  *                                                                      *
  3.  *                  Copyright (c) 1991, Frank van der Hulst             *
  4.  *                          All Rights Reserved                         *
  5.  *                                                                      *
  6.  * Authors:                                                             *
  7.  *          FvdH - Frank van der Hulst (Wellington, NZ)                     *
  8.  *                                                                      *
  9.  * Versions:                                                            *
  10.  *      V1.1 910626 FvdH - QUANT released for DBW_RENDER                *
  11.  *      V1.2 911021 FvdH - QUANT released for PoV Ray                   *
  12.  *                                                                      *
  13.  ************************************************************************/
  14. /************************************************************************
  15. * Declarations, global to other of the GIF-HASH.C module.                  *
  16. *                                                                                              *
  17. *                    Written by Gershon Elber,  Jun 1989                               *
  18. *************************************************************************
  19. * History:                                                                                  *
  20. * 14 Jun 89 - Version 1.0 by Gershon Elber.                                      *
  21. *************************************************************************/
  22.  
  23. #define ZL_MAX_CODE 4095        /* Biggest code possible in 12 bits */
  24. #define HT_SIZE 8192                /* 12 bits = 2 * 4096 */
  25.  
  26. void cdecl HashTable_Clear(unsigned long *HashTable);
  27. void cdecl HashTable_Insert(unsigned long *HashTable, unsigned long Key, int Code);
  28. int  cdecl HashTable_Exists(unsigned long *HashTable, unsigned long Key);
  29.  
  30. #define HT_KEY_MASK        0x1FFF                  /* 13bits keys */
  31. #define HT_KEY_NUM_BITS        13                  /* 13bits keys */
  32. #define HT_MAX_KEY        8191    /* 13bits - 1, maximal code possible */
  33. #define HT_MAX_CODE        4095    /* Biggest code possible in 12 bits. */
  34.  
  35. /* The 32 bits of the long are divided into two parts for the key & code:   */
  36. /* 1. The code is 12 bits as our compression algorithm is limited to 12bits */
  37. /* 2. The key is 12 bits Prefix code + 8 bit new char or 20 bits.        */
  38. #define HT_GET_KEY(l)    (l >> 12)
  39. #define HT_GET_CODE(l)    (l & 0x0FFF)
  40. #define HT_PUT_KEY(l)    (l << 12)
  41. #define HT_PUT_CODE(l)    (l & 0x0FFF)
  42.